

<template>
  <div class="app-container">
    <div>
      <el-row :gutter="10">
        <el-col :span="6" :xs="24" :lg="24">
          <div class="bgwhite plr20 ptb20 radius10 flex-col">
            <div class="justify-between w100p">
              <div class="clr3c4 bold ft26">編輯</div>
              <div class="clr9fa align-center pointer" @click="back()">
                <el-icon>
                  <Back />
                </el-icon>
                <span class="ml5">返回上一頁</span>
              </div>
            </div>
            <div class="mt40">

              <el-form :label-position="labelPosition" label-width="auto" :model="formLabelAlign"
                style="max-width: 600px">
                <el-form-item label="序號:">
                  <el-input v-model="formLabelAlign.id" disabled style="width: 380px;" placeholder="請輸入標題" />
                </el-form-item>
                <el-form-item label="下單地址:">
                  <el-input v-model="formLabelAlign.address" disabled placeholder="請輸入消息内容" />
                </el-form-item>
                <el-form-item label="服務地址:">
                  <el-input v-model="formLabelAlign.service_name" disabled style="width: 380px;" placeholder="請輸入標題" />
                </el-form-item>
                <el-form-item label="審核:">
                  <el-radio-group v-model="formLabelAlign.cancel_result" class="ml-4">
                    <el-radio value="1" size="large"> 同意</el-radio>
                    <el-radio value="2" size="large">拒絕</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="退款狀態:">
                  <el-radio-group v-model="formLabelAlign.is_refund" class="ml-4">
                    <el-radio value="1" size="large">已退款</el-radio>
                    <el-radio value="0" size="large">未退款</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-form>
              <div class="mt40 mb15 flex-cen ">
                <div class="align-center">
                  <el-button class="btn1" @click="reset()">重置</el-button>
                  <el-button class="btn2" @click="submit()">提交</el-button>
                </div>

              </div>
            </div>


          </div>

        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive, ref, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router';
import type { FormProps } from 'element-plus'
import { editRefund } from '@/api/order.js'
const route = useRoute()
const labelPosition = ref<FormProps['labelPosition']>('right')
onMounted(() => {
  console.log(route.query)
  formLabelAlign.id = `${route.query.id}`
  formLabelAlign.cancel_result = `${route.query.cancel_result}`
  formLabelAlign.is_refund = `${route.query.is_refund}`
  formLabelAlign.address = `${route.query.address}`
  formLabelAlign.service_name = `${route.query.service_name}`
})
const submit = () => {
  editRefund({
    id: formLabelAlign.id,
    cancel_result: formLabelAlign.cancel_result,
    is_refund: formLabelAlign.is_refund
  }).then(() => {
    back()
  })
}
const reset = () => {

}
const formLabelAlign = reactive({
  id: '',
  cancel_result: '',
  is_refund: '',
  address: '',
  service_name: ''
})
const router = useRouter()
const back = () => {
  router.back()
}
</script>
<style scoped >
:deep(.el-upload--picture-card) {
  background-color: transparent;
  border: none;
}

:deep(.el-input) {
  box-shadow: none;
}
</style>